package springboot.repository;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import springboot.entity.Teacher;

@Mapper
@Repository
public interface TeacherRepository {

  @Select("select tno, tname, sex, age, tphone from teacher where tno = #{tno}")
  Teacher queryById(Long id);

  @Insert(
      "insert into teacher (tno, tname, sex, age, tphone) "
          + "value ("
          + "#{tno, jdbcType=INTEGER},"
          + "#{tname, jdbcType=VARCHAR},"
          + "#{sex, jdbcType=VARCHAR},"
          + "#{age, jdbcType=INTEGER},"
          + "#{tphone, jdbcType=VARCHAR}"
          + ")")
  void create(Teacher teacher);
}

